package cn.yangliu.repository;

import cn.yangliu.entity.OftenUseCommand;
import cn.yangliu.jpa.base.repository.BaseRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * the type of serial-port-tool
 *
 * <p>
 * .
 *
 * @author 杨柳
 * @date 2021-10-13
 */
public interface OftenUseCommandRepository extends BaseRepository<OftenUseCommand, Long> {

    /**
     * 根据settingId查询常用指令
     *
     * @param settingId settingId
     * @return 常用指令集合
     */
    List<OftenUseCommand> findBySettingId(Long settingId);

    /**
     * 根据settingId删除
     *
     * @param settingId settingId
     */
    @Modifying
    @Query("delete from OftenUseCommand where settingId=:settingId")
    void deleteBySettingId(Long settingId);

}
